#include <iostream>
#include <string>
using namespace std;

int main() {
    string inp, s = "";
    int steps;
    
    cin >> inp;
    
    for (auto& i : inp) {
        if (i == '('  i == '['  i == '{' || i == '<') {
            s += i;
            steps++;
        }
        else if (s.length() > 0) {
            if (i == ')' && s[s.length() - 1] == '(') {
                s.pop_back();
                steps++;
            }
            else if (i == ']' && s[s.length() - 1] == '[') {
                s.pop_back();
                steps++;
            }
            else if (i == '}' && s[s.length() - 1] == '{') {
                s.pop_back();
                steps++;
            }
            else if (i == '>' && s[s.length() - 1] == '<') {
                s.pop_back();
                steps++;
            }
        }
    }
    
    if (inp.length() == steps && s.length() == 0) cout << "True\n";
    else std::cout << "False\n";
}
